import axios from "../utils/http"
//普通登录
export function getLoginRequest(name,pwd) {
    let courseObj = new URLSearchParams()
    courseObj.append("username",name)
    courseObj.append("password",pwd)
    courseObj.append("rememberMe",true)
    return axios.post(`api/pcUser/login`,courseObj)
}
//手机登录请求验证码
export function getPhoneCode(phone) {
    return axios.get(`/api/pcUser/login/send/code/${phone}`)
}
//手机验证码登录
export function loginPhoneCode(phone,code) {
    let courseObj = new URLSearchParams()
    courseObj.append("mobile",phone)
    courseObj.append("code",code)
    courseObj.append("rememberMe",false)
    return axios.post(`/api/pcUser/login/mobile`,courseObj)
}
//忘记密码页的请求验证码
export function forgetCode(user,phone) {
    let courseObj = new URLSearchParams()
    courseObj.append("loginName",user)
    courseObj.append("mobile",phone)
    return axios.post(`/api/pcUser/forgetpassword/send/code`,courseObj)
}
//忘记密码中点击确认密码
export function forgetGoLogin(user,pwd,phone,code) {
    let obj ={
        "loginName":user,
        "password":pwd,
        "mobile":phone,
        "code":code,
    }
    return axios.post(`/api/pcUser/password/forget`,obj)
}
//退出登录
export function logOut() {
    return axios.get(`/api/pcUser/logout`)
}

//查看个人信息
export function viewUserInfo() {
    return axios.get(`/api/pcUser/login-user/info`)
}